//
// Created by wll on 2021/11/24.
//

#ifndef XYZ_COMMAND_H
#define XYZ_COMMAND_H

#include "LanguageSymbols.h"
#include "WllInterpreter.h"
#include <vector>

class Command
{
public:
    Command(const Symbols& cmd, WllInterpreter* wllInterpreter) : command(cmd), interpreter(wllInterpreter) {}
    virtual bool Interpret(std::vector<Symbols>& result) = 0;
    LanguageGrammar* GetChildCompilerGrammar() { return &interpreter->context.language_grammar; }
protected:
    Symbols command;
    WllInterpreter* interpreter;
};

class CommandFactory
{
public:
    virtual Command* CreateCommand(const Symbols& cmd, WllInterpreter* wllInterpreter) = 0;
    virtual bool IsNormalSymbol(const Symbols& cmd);
    virtual bool IsIgnorableSymbol(const Symbols& cmd);
};

#endif //XYZ_COMMAND_H
